<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象遍历方法</title>

    <script>
        // 遍历对象的属性
        const obj = { name: 'John', age: 30, gender: 'male' };

        // 下面三个方法的结果可以使用 for...in 遍历
        console.log(Object.keys(obj)); // ['name', 'age', 'gender']
        console.log(Object.values(obj)); // ['John', 30, 'male']
        
        // [['name', 'John'], ['age', 30], ['gender', 'male']]
        console.log(Object.entries(obj));
    </script>
</head>
<body>
    
</body>
</html>